Show language: C# VB.NET Both

Central Event System (Plug-ins)

Handling Central Events Directly (Without A Plug-in)

Events that are routed through the Central Event System can be handled without an external plug-in assembly. This is more convenient when all operations are performed programmatically - but has the limitation that, obviously, events are not handled when they occur in other processes (eg. the Windows Service, Visual Studio design time, Admin web app.). To access the central events, simply attach to them via the object Configuration.CentralEventDispatcher (where Configuration is the instance of the Configuration being used).

In the following example the Action event is handled at search time, by attaching to the Configuration.CentralEventDispatcher associated with the SearchResult control. Notice that the event handler will only be called during search operations (of course, because that's the context within which the handler is running - the context being the code-behind of the search result page).

C#
protected void Page_Load(object sender, EventArgs e)
{
    SearchResult1.Configuration.CentralEventDispatcher.Action += new
		Keyoti.SearchEngine.Events.ActionEventHandler(CentralEventDispatcher_Action);
}
VB.NET
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    AddHandler (SearchResult1.Configuration.CentralEventDispatcher.Action, AddressOf CentralEventDispatcher_Action)

End Sub